<template>
    <div>
        <div class="history-hot">
            <div class="his-hot">
                <div class="hd">
                    <h4>历史记录</h4>
                    <van-icon name="delete-o" @click="del()" />
                </div>
                <div class="bd">
                    <van-tag plain type="default" v-for="(v,k) in historyKeywordList" :key="k" @click="biaoqian(v)">{{v}}</van-tag>
                </div>
            </div>
             <div class="his-hot">
                <div class="hd">
                    <h4>热门搜索</h4>
                </div>
                <div class="bd">
                    <van-tag plain :type="v.is_hot==1 ? 'danger':'default'" v-for="(v,k) in hotKeywordList" :key="k" @click="biaoqian(v.keyword)">{{v.keyword}}</van-tag>
                </div>
            </div>    
        </div>
    </div>
</template>

<script>
import { Form } from 'vant'
import {GetDelSearchHistory} from "@/request/api"
export default {
   props:["historyKeywordList","hotKeywordList"],
   data(){
    return{
 
    }
  },
   methods:{
       del(){
        GetDelSearchHistory().then(res=>{
            // console.log(res);
            if(res.errno==0){
                alert('删除成功')
            }
        })
       },
       biaoqian(m){
           console.log(m);
           this.$emit('c_fu',m)
       }
  },
   components:{

  }
}
</script>

<style lang='less' scoped>
    .his-hot{
        background-color:#fff;
        padding:2%;
        margin-bottom: .2rem;
        padding-bottom:.2rem;
        .hd{
            display:flex;
            justify-content:space-between;
            margin-bottom:.1rem;
        }
        .bd{
            .van-tag{
                margin-right:.1rem;
                margin-top:.07rem;
            }
        }
    }
</style>